-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: respect braces better in f-string parsing #4422
Conversation
Thanks! Could you add a changelog entry since this fixes crashes on some real-world code? Also might be worth adding a few more test cases; I'll take a look tonight and maybe push some too. |
This fixes the two crashing cases, but doesn't fix the incorrect parses. Still looking into that one. |
|
I have a fix for the remaining cases locally, will put up a PR once #4423 is done. |
@JelleZijlstra I just made a fix, see if you can find any bugs with this one? |
Description
Tiny inconsistency between two regexes, one had a part changed to
\\[^{]
whereas the other was left to be\\.
, causing a crash in parsing in some cases.The regex was a bit unreasonably complex though, it doesn't need to have
\\.
or\\[^{]
in it anyway. This simplifies the regex and makes it more compatible.Resolves #4421